import { request } from "../request";

/** 获取当前所有任务 */
export const GetJobTaskList = async () => {
	const data = await request.post<TaskCenter.GetJobTaskListOutput[] | null>(
		"/taskCenter/list",
	);
	return data;
};

/** 添加或者更新任务 */
export const addOrUpdate = async (
	input: TaskCenter.AddOrUpdateJobTaskInput,
) => {
	const data = await request.post("/taskCenter/addOrUpdate", input);
	return data;
};

/** 手动触发任务 */
export const triggerJob = async (jobId: string) => {
	const data = await request.post("/taskCenter/triggerJob?jobId=" + jobId);
	return data;
};


/** 删除任务 */
export const delJob = async (jobId: number) => {
	const data = await request.delete("/taskCenter/delJobTask/" + jobId);
	return data;
};


/** 停止任务 */
export const stopJob = async (jobId: number) => {
	const data = await request.delete("/taskCenter/stopJobTask/" + jobId);
	return data;
};
